/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.scm.struts.forms;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author Sony
 */
public class FacultyRegisterForm extends org.apache.struts.action.ActionForm {
    
    private  String fname,lname,mname,gender,email,password,address,city,f_state,contact,qualification,designation;
    private  long id;
    private int bday,jday,bmonth,jmonth,byear,jyear;

    public String getFname() {
        return fname;
    }

    public void setFname(String fname) {
        this.fname = fname;
    }

    public String getLname() {
        return lname;
    }

    public void setLname(String lname) {
        this.lname = lname;
    }

    public String getMname() {
        return mname;
    }

    public void setMname(String mname) {
        this.mname = mname;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getF_state() {
        return f_state;
    }

    public void setF_state(String f_state) {
        this.f_state = f_state;
    }

    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    

    public String getQualification() {
        return qualification;
    }

    public void setQualification(String qualification) {
        this.qualification = qualification;
    }

    public String getDesignation() {
        return designation;
    }

    public void setDesignation(String designation) {
        this.designation = designation;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

   

    public int getBday() {
        return bday;
    }

    public void setBday(int bday) {
        this.bday = bday;
    }

    public int getJday() {
        return jday;
    }

    public void setJday(int jday) {
        this.jday = jday;
    }

    public int getBmonth() {
        return bmonth;
    }

    public void setBmonth(int bmonth) {
        this.bmonth = bmonth;
    }

    public int getJmonth() {
        return jmonth;
    }

    public void setJmonth(int jmonth) {
        this.jmonth = jmonth;
    }

    public int getByear() {
        return byear;
    }

    public void setByear(int byear) {
        this.byear = byear;
    }

    public int getJyear() {
        return jyear;
    }

    public void setJyear(int jyear) {
        this.jyear = jyear;
    }
    
    
    
   
    public FacultyRegisterForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     *
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();

        
//        Pattern contact_regex = Pattern.compile("[7-9][0-9]{9}");
//        Matcher contact_matcher = contact_regex.matcher(getContact());
//        
//        Pattern fname_regex = Pattern.compile("[a-z|A-Z]+");
//        Matcher fname_matcher = fname_regex.matcher(getFname());
//       
//        Pattern mname_regex = Pattern.compile("[a-z|A-Z]+");
//        Matcher mname_matcher = mname_regex.matcher(getMname());
//        
//        Pattern lname_regex = Pattern.compile("[a-z|A-Z]+");
//        Matcher lname_matcher = lname_regex.matcher(getLname());
//        
//        Pattern city_regex = Pattern.compile("[a-z|A-Z]+");
//        Matcher city_matcher = city_regex.matcher(getCity());
//        
//        Pattern state_regex = Pattern.compile("[a-z|A-Z]+");
//        Matcher state_matcher = state_regex.matcher(getF_state());
//        
//        Pattern qualification_regex = Pattern.compile("[a-z|A-Z]+");
//        Matcher qualification_matcher = qualification_regex.matcher(getQualification());
//        
//        Pattern designation_regex = Pattern.compile("[a-z|A-Z]+");
//        Matcher designation_matcher = designation_regex.matcher(getDesignation());
//        
//        if (getFname() == null || getFname().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("fname", new ActionMessage("faculty-register-error-fname-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (!fname_matcher.matches()) {
//             errors.add("fname", new ActionMessage("faculty-register-error-fname-valid"));
//        }
//        
//        if (getMname() == null || getMname().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("mname", new ActionMessage("faculty-register-error-mname-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (!mname_matcher.matches()) {
//             errors.add("mname", new ActionMessage("faculty-register-error-mname-valid"));
//        }
//        if (getLname() == null || getLname().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("lname", new ActionMessage("faculty-register-error-lname-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (!lname_matcher.matches()) {
//             errors.add("lname", new ActionMessage("faculty-register-error-lname-valid"));
//        }
//        if (getGender() == null || getGender().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("gender", new ActionMessage("faculty-register-error-gender-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (getEmail() == null || getEmail().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("email", new ActionMessage("faculty-register-error-email-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (getPassword() == null || getPassword().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("password", new ActionMessage("faculty-register-error-password-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (getAddress() == null || getAddress().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("address", new ActionMessage("faculty-register-error-address-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (getCity() == null || getCity().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("city", new ActionMessage("faculty-register-error-city-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (!city_matcher.matches()) {
//             errors.add("city", new ActionMessage("faculty-register-error-city-valid"));
//        }
//        
//        if (getF_state() == null || getF_state().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("state", new ActionMessage("faculty-register-error-state-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (!state_matcher.matches()) {
//             errors.add("state", new ActionMessage("faculty-register-error-state-valid"));
//        }
//        if (getQualification() == null || getQualification().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("qualification", new ActionMessage("faculty-register-error-qualification-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (!qualification_matcher.matches()) {
//             errors.add("qualification", new ActionMessage("faculty-register-error-qualification-valid"));
//        }
//        if (getDesignation()== null || getDesignation().length() < 1) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("designation", new ActionMessage("faculty-register-error-dersignation-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//        if (!designation_matcher.matches()) {
//             errors.add("designation", new ActionMessage("faculty-register-error-designation-valid"));
//        }
//        
//        if (getContact() == null || getContact().length() != 10) {
//            // System.out.println(" Error Avi bhai");
//            errors.add("contact", new ActionMessage("faculty-register-error-contact-required"));
//            // TODO: add 'error.name.required' key to your resources
//        }
//          if (!contact_matcher.matches()) {
//             errors.add("contact", new ActionMessage("faculty-register-error-contact-valid"));
//        }
        return errors;
    }
}
       
    

